import { http } from '@/utils/http'

export const postMemberAddressAPI = (data) => {
  return http({
    method: 'POST',
    url: '/member/address',
    data,
  })
}

export const postMemberAddressAPI2 = (data) => {
  return http({
    method: 'POST',
    url: '/api/personal/addAddress',
    data,
  })
}

export const getMemberAddressAPI = () => {
  return http({
    method: 'GET',
    url: '/member/address',
  })
}

export const getMemberAddressAPI2 = () => {
  return http({
    method: 'POST',
    url: '/api/personal/getAddressList',
  })
}

export const getMemberAddressByIdAPI = (id) => {
  return http({
    method: 'GET',
    url: `/member/address/${id}`,
  })
}

export const getMemberAddressByIdAPI2 = (id) => {
  return http({
    method: 'POST',
    url: `/api/personal/getAddress`,
    data: { id },
  })
}

export const putMemberAddressByIdAPI = (id, data) => {
  return http({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}

export const putMemberAddressByIdAPI2 = (id, data) => {
  return http({
    method: 'POST',
    url: `/api/personal/updateAddress`,
    data: {
      id,
      ...data,
    },
  })
}

export const deleteMemberAddressByIdAPI = (id) => {
  return http({
    method: 'DELETE',
    url: `/member/address/${id}`,
  })
}

export const deleteMemberAddressByIdAPI2 = (id) => {
  return http({
    method: 'POST',
    url: `/api/personal/delAddress`,
    data: {
      id,
    },
  })
}
